UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5Hi9Bn2wmdLTDhawpVWEWrEv47CuKq50hz0IL3q/s5Q=' 
WHERE 
  key_id = '1b8b86d1d71676d447d8f85d0b8dab410a97edcd627e7c68c2a11523f06b67fd' 
  AND (
    token = '5Hi9Bn2wmdLTDhawpVWEWrEv47CuKq50hz0IL3q/s5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024