UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1T55iAmHaCrTBq5uoX8F45dru48xTzVCN3Qj4nzXow0='
WHERE
key_id = 'a06470fef37b0445f0776bd4cadad202e424c7e5938989c8b82fb72ea3e446a0'
AND (
token = '1T55iAmHaCrTBq5uoX8F45dru48xTzVCN3Qj4nzXow0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)