UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9vVd/C9iROpK6dtkcXMOnleYYTodojcWPzqKhW2d6g8='
WHERE
key_id = '4408e00fbf4b895b0d2af3612593b7a9fc662b9f9a295887618004e441181240'
AND (
token = '9vVd/C9iROpK6dtkcXMOnleYYTodojcWPzqKhW2d6g8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)