UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZPORrz2uxRONEWAniDIzUHukiJL8Mg44+0QcHLg+4i4='
WHERE
key_id = '13c31482ec233e9db9efd41f98604da10f8c58a86ae3cf178a1838460a5f86b4'
AND (
token = 'ZPORrz2uxRONEWAniDIzUHukiJL8Mg44+0QcHLg+4i4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)