UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4XfUw4DHVw3TwtYAcD9HBDcl8gRYYGM0F0mC/peyFj4='
WHERE
key_id = 'd3a0c55fcbf9840652a54f950b065307e657dc057579e63575df555eb0692b9f'
AND (
token = '4XfUw4DHVw3TwtYAcD9HBDcl8gRYYGM0F0mC/peyFj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)