UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pgtszcMnQ+fzMpxtmL2o9dWJ7wWRio8Xuk0x+lX+QHs=' 
WHERE 
  key_id = '7427aa162e77afea17787680c125f0edd632a729f0b8c987037293650cb0afd3' 
  AND (
    token = 'pgtszcMnQ+fzMpxtmL2o9dWJ7wWRio8Xuk0x+lX+QHs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040