UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tNNfDRYvyW6hYn2p0UpYLdeF1dNIQYStZ7MGLe7eplc='
WHERE
key_id = '9f3847351c5f0dda662e443e0752fe8cc7e9965bb4d7bf82f314e5b07540a418'
AND (
token = 'tNNfDRYvyW6hYn2p0UpYLdeF1dNIQYStZ7MGLe7eplc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)