UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dG6802EDBPPJ6JyZHpUfxESJhOKXz5PECYlNNWOMvCU='
WHERE
key_id = '2d7f7562a607c2393c94403901657227b13c89e5476ee5eb0e646dea6f734273'
AND (
token = 'dG6802EDBPPJ6JyZHpUfxESJhOKXz5PECYlNNWOMvCU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)