UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DtrdoRW4UmDh02KiEACgP43fQq8d2jZMXpMDhFjias0=' 
WHERE 
  key_id = '4e854d45cd7a9a2100eea63f678dd945de7a1ef169aa87ce5e9e396557b3c6d3' 
  AND (
    token = 'DtrdoRW4UmDh02KiEACgP43fQq8d2jZMXpMDhFjias0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044