UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yILDyg1lQCcOzjxhUjSxyc2nlUszm7bEh0Om9ZIfiW8=' 
WHERE 
  key_id = '9cc3c5519c4a3144e71021a700610cf2fb3d17ea0f804e1a470f012d98ac92fa' 
  AND (
    token = 'yILDyg1lQCcOzjxhUjSxyc2nlUszm7bEh0Om9ZIfiW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035