UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'akyIpuL4SSmpEDZykXhzHL5ECU1u3lOWicxRe5E2ebs='
WHERE
key_id = '7ae8b942eb8c7d2d77929c9d65bf87046990c98dc7d6b0064a76b011285d194f'
AND (
token = 'akyIpuL4SSmpEDZykXhzHL5ECU1u3lOWicxRe5E2ebs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)