UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5XIm6JxQg1wvL1nLxvHbYT+vD0fjcO1aqofwK3aHsrw='
WHERE
key_id = 'd044f4d66e144f32b99f97aa126393d49d947a840038d0f135df0776777c5d1e'
AND (
token = '5XIm6JxQg1wvL1nLxvHbYT+vD0fjcO1aqofwK3aHsrw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)