UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GJnHd7BMqGBHCXgssNZZgcvZK5IIBoeGvKhO+WVCHXg=' 
WHERE 
  key_id = 'd9857cca94236c56d917f6fa6e883a93f2dc266f992a219629dfd47236c9a411' 
  AND (
    token = 'GJnHd7BMqGBHCXgssNZZgcvZK5IIBoeGvKhO+WVCHXg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045