UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n9mWUBFiJIql9Rk576ca7oe7muaQEUsgilaYYLB+m1c='
WHERE
key_id = '8c8c04d8522a8522996f22b76562b57d5991ceb0edd79812d8c60a1b27db2eaa'
AND (
token = 'n9mWUBFiJIql9Rk576ca7oe7muaQEUsgilaYYLB+m1c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)