UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5I4TH98ccpwnsqGz/m10LQLyHxwzScUVByo1grNmjUc='
WHERE
key_id = '1d17b034f548a293005d988c568a6f18ca1ffd208678488d9564823c194e8b6a'
AND (
token = '5I4TH98ccpwnsqGz/m10LQLyHxwzScUVByo1grNmjUc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)