UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sgyy9Ocfduj19KmraT3GTNysn6U1spoFcqM4jg7kF64=' 
WHERE 
  key_id = '3920c7365303025378ee3cb832dc21e002ee28f517f18f88910146049003a4ac' 
  AND (
    token = 'Sgyy9Ocfduj19KmraT3GTNysn6U1spoFcqM4jg7kF64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050