UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GsdbQ02sip2IQc8F84PTYZdzd5NCKf0nxgzy57TCq1Q=' 
WHERE 
  key_id = '2dbf06f691aea13bdc160f6f7b2189d72a3a131f35ca87d02664e60ba787716c' 
  AND (
    token = 'GsdbQ02sip2IQc8F84PTYZdzd5NCKf0nxgzy57TCq1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036