UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mtlb3I8YDdYIvUKKoB+4qNHHgjkbM4Zvrq+zAIbZAnQ='
WHERE
key_id = '3a1ce66e96c691cb586c3af9a57f5e52945afb0f9f65588996c0172f4a5fd88a'
AND (
token = 'Mtlb3I8YDdYIvUKKoB+4qNHHgjkbM4Zvrq+zAIbZAnQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)