UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hYG1TaCRZVZnWjT7spMyo+LcqWGtASDXkzc28d+cizk='
WHERE
key_id = '0ed64e81cebf84b6215e625360fe22be25eaed67cdeed3ce9aa36c603ed0042a'
AND (
token = 'hYG1TaCRZVZnWjT7spMyo+LcqWGtASDXkzc28d+cizk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)