UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sBCFBtC6VkpPFbc3/Jmex8efc3g4wl3ShQ254bqODA8=' 
WHERE 
  key_id = '58d6004973eaf47807ce63bf82dbbeb7f417de29f39c150439c9a97212572499' 
  AND (
    token = 'sBCFBtC6VkpPFbc3/Jmex8efc3g4wl3ShQ254bqODA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039