UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tW4eT4KN0Dpyr75sz31mF9JERIeeOGRtT+A1PCzwazs='
WHERE
key_id = '9e8828726caeffc959529e94a379e55fb43b20311d15d0e990e123db6305c9ec'
AND (
token = 'tW4eT4KN0Dpyr75sz31mF9JERIeeOGRtT+A1PCzwazs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)