UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F4r5TEps/GsliIfRcnDQ2XusQJ8U/Vi+Y7U0qTs0+4Y='
WHERE
key_id = 'd83b43ed8bb33a89b171030793a63e769107e965c941c8f0aa94a4fe6e4814ce'
AND (
token = 'F4r5TEps/GsliIfRcnDQ2XusQJ8U/Vi+Y7U0qTs0+4Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)