UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ENWanEkMwS3JNtdazwM+F1BKu9qlfZG8xvza9xL0vOE='
WHERE
key_id = '5776d6e6fab7afc7b47519231a0b05ec1fcae1804e737d824f18c5c4ced29fa1'
AND (
token = 'ENWanEkMwS3JNtdazwM+F1BKu9qlfZG8xvza9xL0vOE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)