UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RfKGseBdPvX6m2KJsV/iqlk+4IAriYerO35Yu1fbErY=' 
WHERE 
  key_id = '8f7a3265418948b43daada615a9a99d54bcce14a4fd3cf7218aa3452083e55e7' 
  AND (
    token = 'RfKGseBdPvX6m2KJsV/iqlk+4IAriYerO35Yu1fbErY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034