UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qHsZ6jDaiCJFb2+hupFUelFRYWxAXxao+EZTrcsFGtI=' 
WHERE 
  key_id = '870753e067d7bb4b808627828ed6ba5a8d5e4c5aaa5e786ae3408dc88091c578' 
  AND (
    token = 'qHsZ6jDaiCJFb2+hupFUelFRYWxAXxao+EZTrcsFGtI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023