UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HzXs5nWUQoHyNWt11KpC2q7UAeNzj+btIiAMOzCBM4Q='
WHERE
key_id = 'c87c44ed73cdbbf6934499c6beb94f8cb570329c2d1684f6f3c0215a0124983c'
AND (
token = 'HzXs5nWUQoHyNWt11KpC2q7UAeNzj+btIiAMOzCBM4Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)