UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y5oMA/HbgYFV107m1ftq+F5KNLBy9nfFv1bHV0Exw10='
WHERE
key_id = '6d437ec308880ef3876b60ee32c6438edcbbf2ee776c3b5df65427e3d283f613'
AND (
token = 'y5oMA/HbgYFV107m1ftq+F5KNLBy9nfFv1bHV0Exw10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)