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

Query time 0.00023