UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9dVz1OjieafAm/gbPZjDqkv8LUBdXtbceYeY7AzeRvI=' 
WHERE 
  key_id = 'fa90f28a8be5d0539cc8a36408e35dbca08956311df889910125c37109383777' 
  AND (
    token = '9dVz1OjieafAm/gbPZjDqkv8LUBdXtbceYeY7AzeRvI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040