UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PwYZXZJdq0QmlwuJJWN29B+UGXNtNOFNlaTEBfBa/Rw='
WHERE
key_id = 'b50498f643dc6161981fa4742edbcfa43a3d89e28cbf7b330dc8b2c8c25d37fe'
AND (
token = 'PwYZXZJdq0QmlwuJJWN29B+UGXNtNOFNlaTEBfBa/Rw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)