UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pX4piR8RBd2xVH0XLuSKaUyl8CLN/j1irOGDiPdHNpI='
WHERE
key_id = '00777d566f2b4ad3d6da6766f1ea9a0354b3817584aeb3a5701d5cf842621941'
AND (
token = 'pX4piR8RBd2xVH0XLuSKaUyl8CLN/j1irOGDiPdHNpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)