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