UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SVdMCK1BtDi4yt69aHur9onM8EjjTRTRVFaQl33FAnQ=' 
WHERE 
  key_id = 'c6d51ca86beb6604abbff23b05050cd6e652af4b9559ec482ea9938e4a85c181' 
  AND (
    token = 'SVdMCK1BtDi4yt69aHur9onM8EjjTRTRVFaQl33FAnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023