UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R97MY8Agw+NKPwVWZPkV7V9M9khxJci1ZgT16I/G390=' 
WHERE 
  key_id = '0969a873f4abdb5261a254cda9a1816a5aa515ac55c988b8a10f302b46f3d18c' 
  AND (
    token = 'R97MY8Agw+NKPwVWZPkV7V9M9khxJci1ZgT16I/G390=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029