UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/Nq0oxiciO0H8kCE5Oy/5XEHw2AVbBfTjsSd+KqQUzY='
WHERE
key_id = 'e9048eec91c00db5c9f44552db49c10f5bb48c5cb35bb22db069865a596e66bd'
AND (
token = '/Nq0oxiciO0H8kCE5Oy/5XEHw2AVbBfTjsSd+KqQUzY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)