UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R29Rd5DlLNdoWtdkMjxRKV5n7oOUXAgv1QQeN9E0Ses=' 
WHERE 
  key_id = '28082c0651806ef81be8d2663e05e7ad08bace914af5dd584e60f9d9e36dcb77' 
  AND (
    token = 'R29Rd5DlLNdoWtdkMjxRKV5n7oOUXAgv1QQeN9E0Ses=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023