UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j5p7aqbVKaL2hdxYxUirEdLotgBfZEHMWPLW2Q5TuVU='
WHERE
key_id = 'd7e108417b95d59628115d5adc0e07a5d4f7643af6250cbb7bf8f8d06c3b1c02'
AND (
token = 'j5p7aqbVKaL2hdxYxUirEdLotgBfZEHMWPLW2Q5TuVU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)