UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qRPPpfyyjokdsioEvf9gqiFp5yFj3UUA19E5r3NPTvU='
WHERE
key_id = '0cb82f51d2820445c718e65fd7cb4b3a4215eafcbc1961216ac757d5af031c7d'
AND (
token = 'qRPPpfyyjokdsioEvf9gqiFp5yFj3UUA19E5r3NPTvU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)