UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CHYB9WfPOCpxkQydY219Vog1iW7hFe0wflOMf3T9PAY='
WHERE
key_id = '31bfe750fe05f05f90410f75619affacd17b272657d70def8c74e0acc67fdd8e'
AND (
token = 'CHYB9WfPOCpxkQydY219Vog1iW7hFe0wflOMf3T9PAY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)