UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8u4RgekOad+/Tm3EW1UqzxXj653xnXOFiAXWeoz1r50=' 
WHERE 
  key_id = 'b5c30436d5bfbf640ece1ee4323274164cacad95bc22e5c5eff5f98b2224dbed' 
  AND (
    token = '8u4RgekOad+/Tm3EW1UqzxXj653xnXOFiAXWeoz1r50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030