UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KgIDFRZJYAOjkGYse/CWE+iUWzffDYVW5eZ+YEcmJRw=' 
WHERE 
  key_id = '30c3192bba74d397c31dfdf8ba9255a2b137e48c8ee3e6cc3c2a554670b6985c' 
  AND (
    token = 'KgIDFRZJYAOjkGYse/CWE+iUWzffDYVW5eZ+YEcmJRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022