UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bflJ7xsm0g+V7XeZlpQgdnxwLrjzi/O3LareFELz+1I=' 
WHERE 
  key_id = '2f0c71f35fed4b580ad1c14782020b0646826a63422c622e4630c934225a2702' 
  AND (
    token = 'bflJ7xsm0g+V7XeZlpQgdnxwLrjzi/O3LareFELz+1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021