UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6E6ZDjJNsFTDbu4ZtVqbgNxULIERkZpbUM+jm6MPANg=' 
WHERE 
  key_id = '3eab773ca1a8496cc7abc7fdc3442bb921369e78971fe712f22f375bd658e6f4' 
  AND (
    token = '6E6ZDjJNsFTDbu4ZtVqbgNxULIERkZpbUM+jm6MPANg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036