UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0396A0oFOaeiK75UchCdPYIJ0JvTP8ZK8Q5uN6rzkY8='
WHERE
key_id = 'c49e56362819a5738fbb91211d0b3e203199397fd07f1b7b42e6da58e694f333'
AND (
token = '0396A0oFOaeiK75UchCdPYIJ0JvTP8ZK8Q5uN6rzkY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)