UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'klAN187ShDsiKHvANNpIWhl6MwC3nAwqDwi6ELIBHyE='
WHERE
key_id = '24540a75881469fa37270615192a55abf30fe3b4c8850b473300f123a3e70a05'
AND (
token = 'klAN187ShDsiKHvANNpIWhl6MwC3nAwqDwi6ELIBHyE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)