UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0XMhZTbAqiB36KvWZfwznlwi8LNWPMExOnlBB0HUTHs='
WHERE
key_id = 'cff4b3f71213c33444f29b953eba18b8707a2ffc693c7b8d835abfa5bc1bfd32'
AND (
token = '0XMhZTbAqiB36KvWZfwznlwi8LNWPMExOnlBB0HUTHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)