UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9sc+8paUvBi479mBCIGE1vEBnBP5RiWx75UN9nCok3c='
WHERE
key_id = 'c7c4dc0e047a17163f71f480dcfdc974ee386cba1d7e6420a3b50b4b39165fb2'
AND (
token = '9sc+8paUvBi479mBCIGE1vEBnBP5RiWx75UN9nCok3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)