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